package hdfs_pro;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class Rename {
    public static void main(String[] args) {
        try {
              Configuration conf = new Configuration();
              FileSystem fs = FileSystem.get(conf);
              String srcStrPath = args[0];
              String dstStrPath = args[1];
              Path srcPath = new Path(srcStrPath);
              Path dstPath = new Path(dstStrPath);
          if(fs.rename(srcPath,dstPath)) {
                System.out.println("rename from " + srcStrPath + " to " + dstStrPath + "successfully!");
          }
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
}